package com.example.listener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

@Component
public class CustomApplicationListener implements ApplicationListener<ContextRefreshedEvent> {

    private static final Logger logger = LoggerFactory.getLogger(CustomApplicationListener.class);

    @Override
    public void onApplicationEvent(ContextRefreshedEvent event) {
        logger.info("Context Refreshed Event triggered in CustomApplicationListener");
        // 执行初始化操作，例如加载缓存数据
    }
}
